<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" class="input-check" /><button class="btn-check">检查</button>

    <script>
        window.onload = function() {
            var inputCheck = document.querySelector(".input-check");
            var btnCheck = document.querySelector(".btn-check");

            btnCheck.addEventListener("click", function() {
                var value = inputCheck.value;
                var arr = value.split("@");
                if (arr.length != 2) {
                    alert("不是邮箱地址");
                    return;
                }
                if (arr[0] === "") {
                    alert("不是邮箱地址");
                    return;
                }
                var arr2 = arr[1].split(".");
                if (arr2[0] === "") {
                    alert("不是邮箱地址");
                    return;
                }
                if (arr2.length != 2) {
                    alert("不是邮箱地址");
                    return;
                }
                if (arr2[1] !== "com") {
                    alert("不是邮箱地址");
                    return;
                }
                alert("这是邮箱地址");
                return;
            })
        }
    </script>
</body>

</html>